package com.yanqu.road.server.cmd.activity.busyfarming;

import com.yanqu.road.pb.activity.BusyFarmingProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.busyfarming.CrossBusyFarmingMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

import java.util.List;

@Cmd(code = Protocol.C_BUSY_FARMING_ACTIVITY_STEAL_SEARCH, desc = "偷菜-查找")
public class CrossStealSearchCmd extends CrossCommand {

    int activityId;
    String unionUid;
    List<Long> friend;
    int grade;
    int gradeRange;
    List<Long> stolen;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        BusyFarmingProto.CrossBusyFarmingStealSearchReqMsg reqMsg = BusyFarmingProto.CrossBusyFarmingStealSearchReqMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        unionUid = reqMsg.getUnionUid();
        friend = reqMsg.getFriendList();
        grade = reqMsg.getGrade();
        gradeRange = reqMsg.getGradeRange();
        stolen = reqMsg.getStolenUserList();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossBusyFarmingMgr.searchStealList(serverId, activityId, unionUid, packet.getPlayerId(), friend, grade, gradeRange, stolen);
    }

    @Override
    public void sendData() {

    }
}
